var viewLeadSourceModel = new function () {
    this.SourceId = ko.observable(data.LeadSourceInfo.SourceId);
    this.Title = ko.observable(data.LeadSourceInfo.Title).extend({ required: { message: "Tiêu đề là yêu cầu"} });
    this.Note = ko.observable(data.LeadSourceInfo.Note);
    this.Active = ko.observable(data.LeadSourceInfo.Active);

    this.Submit = function () {
        if (viewLeadSourceModel.errors().length == 0) {
            $('form').submit();
        }
        this.errors.showAllMessages();
    }
}

viewLeadSourceModel.errors = ko.validation.group(viewLeadSourceModel);
ko.validation.rules.pattern.message = 'Invalid.';
ko.applyBindings(viewLeadSourceModel, document.getElementById("main"));